-
Notifications
You must be signed in to change notification settings - Fork 56
Trigger packit only for specific package in monorepo #2850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Trigger packit only for specific package in monorepo #2850
Conversation
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: packit_service/worker/jobs.py
Did you find this useful? React with a 👍 or 👎 |
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 53s |
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 58s |
d09f661 to
20aa8b5
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 55s |
3f4d48e to
9d9bb32
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 2m 03s |
9d9bb32 to
8bf7bb0
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 58s |
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 50s |
eb79df6 to
59420ee
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 53s |
mfocko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, mostly formatting remarks… there's also one thing with the common options shared at the top-level, but I might be wrong there 👀
packit_service/worker/jobs.py
Outdated
| parser.add_argument("--all-branches", action="store_true") | ||
| parser.add_argument("--with-pr-config", action="store_true") | ||
| parser.add_argument("--resolve-bug") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those aren't common for all Packit commands, are they? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's an issue… though the question is what should happen when you use an option that's not supported by some command, e.g., --resolve-bug is definitely not supported by /packit build…
Probably error > silent-ignore, but not sure about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they aren't common for all commands. I think it should be fixed in the later commits, where I made a subparser for each command, so that these arguments are defined only for the commands that support them.
| args = parser.parse_args(commands) | ||
| return {"command": args.command, "monorepo_package": args.package} | ||
| except argparse.ArgumentError: | ||
| except SystemExit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exit? 👀 that's from the argparse I presume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was really surprised. I was expecting to get argparse.TypeError when the parser encountered an error, but the except argparse.TypeError clause got skipped when running tests and tests failed with SystemExit.
|
Build succeeded. ✔️ pre-commit SUCCESS in 2m 32s |
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 49s |
mfocko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one suggestion for a smaller improvement
11026b5 to
769378a
Compare
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces support for a --package parameter in PR comments to target specific packages in a monorepo, using argparse for comment parsing. The implementation is solid, but I have a few suggestions to improve code clarity, maintainability, and correctness. Specifically, I've pointed out an incorrect type hint and docstring, some dead code that can be removed, and an opportunity to refactor duplicated code.
Packit-service now supports the `--package` parameter in PR comments to specify package for which to run jobs. One test was added to test this functionality.
Comment parser has been split to two separate parsers: regular and for Fedora CI. Each has its own defined arguments as per Packit documentation.
By default, argparse seems to ignore newlines in the epilog string used when generating help message, resulting in a messy help message. RawTextHelpFormatter ensures the message (specifically, the epilog part) is formatted properly. This going to be needed when argparse is utilized by `/packit help` command in the future.
Co-authored-by: Matej Focko <[email protected]>
As per mfocko's suggestion, the parse_comment function now returns an instance of ParsedComment rather than a dictionary to increase the amount of code clarity. The parse_comment function now also features a simple example in docstring.
Apply suggestions for cleaner code by removing unnecessary ternaries and adjusting `ParsedComment` appropriately. Co-authored-by: Matej Focko <[email protected]>
This function never returns `None`, so the type hint has been edited to reflect this. The docstring has also been updated to describe the correct return value.
769378a to
108df99
Compare
|
Build failed. ❌ pre-commit FAILURE in 1m 44s |
|
/gemini review |
|
Build failed. ✔️ pre-commit SUCCESS in 1m 48s |
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces support for triggering jobs for specific packages in a monorepo by adding a --package argument to PR comments. The implementation refactors command parsing to use Python's argparse module, which is a great improvement for robustness and maintainability. The changes are well-structured and include a new integration test for the feature.
I've found one issue with the filtering logic when --package is used on a non-monorepo project, which could lead to unintended job triggers. I've left a suggestion to correct this behavior. Overall, this is a solid contribution.
In previous implementation, using the `--package` parameter in a non-monorepo project would result in this parameter being ignored no matter the value given. With this new approach, using the `--package` parameter incorrectly in a non-monorepo project will result in all jobs being filtered out instead. Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Build failed. ✔️ pre-commit SUCCESS in 1m 47s |
|
recheck |
|
Build failed. ✔️ pre-commit SUCCESS in 1m 45s |
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 45s |
Packit-service now supports the
--packageparameter in PR comments to specify package for which to run jobs. One test was added to test this functionality.TODO:
packit/packit.dev.There is some commented monorepo-related code in
process_fedora_ci_jobs. It's not used, but might be useful in future.Fixes #2467
Related to
Merge before #1073
RELEASE NOTES BEGIN
Packit-service now supports the
--packageparameter in PR comments to specify package for which to run jobs.RELEASE NOTES END